﻿<%@ Page Title="MyDrafts" Language="C#" MasterPageFile="~/IdeaNMR/IdeaNMR.master"
    AutoEventWireup="true" Inherits="IdeaNMR.Web.MyDrafts"
    CodeBehind="MyDrafts.aspx.cs" %>

<%@ MasterType TypeName="IdeaNMR.Web.IdeaNMR_Master" %>
<%@ Import Namespace="IdeaNMR.Web.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CphMaster"
    runat="Server">
    <asp:ScriptManagerProxy runat="server" />
    <asp:UpdateProgress runat="server" DisplayAfter="300"
        AssociatedUpdatePanelID="upMain">
        <ProgressTemplate>
            <asp:Image CssClass="MyDrafts_ASPX UpdateProgress" ImageUrl="Images/WaitRefresh_Black.gif"
                runat="server" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel runat="server" ID="upMain">
        <ContentTemplate>
            <asp:LinqDataSource ID="ldsDrafts" runat="server" ContextTypeName="IdeaNMR.Web.Core.IdeaNMRdbContainer"
                OnSelecting="ldsDrafts_OnSelect">
            </asp:LinqDataSource>
            <!-- Essentially CommandName attribute of Delete LinkButtons must not be "Delete" since this causes the 
    delete event be passed throug to the LinqDataSource, which does not support deleting. 
    Check both AlternatingItemTemplate and ItemTemplate for same values.-->
            <asp:Panel runat="server" Style="position: relative;
                overflow: auto;">
                <asp:ListView ID="lvDrafts" runat="server" DataSourceID="ldsDrafts"
                    EnableModelValidation="True">
                    <AlternatingItemTemplate>
                        <tr style="background-color: #FAFAD2; color: #284775">
                            <td>
                                <asp:HyperLink ID="HyperLink1" Style="padding: 0px 5px 0px 5px"
                                    runat="server" Target="_parent" NavigateUrl='<%# ShowLink((Guid)Eval("Obj.Id"), (BaseObject)Eval("Obj")) %>'>Open</asp:HyperLink>
                            </td>
                            <td>
                                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Obj.Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="DatetimeLabel" runat="server" Text='<%# Eval("Obj.Datetime") %>' />
                            </td>
                            <td>
                                <asp:Label ID="TypeLabel" runat="server" Text='<%# ShowType((BaseObject)Eval("Obj"))  %>' />
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnDelete" Text="Delete" Style="padding: 0px 5px 0px 5px"
                                    runat="server" CommandName="TryDelete" CommandArgument='<%# (Guid)Eval("Obj.Id") %>'
                                    OnCommand="butDelete_OnCommand" />
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    <EmptyDataTemplate>
                        <div id="divEmptyData" class="Table EmptyData">
                            You have no DRAFTS. Cheers!
                        </div>
                    </EmptyDataTemplate>
                    <ItemTemplate>
                        <tr style="background-color: #FFFBD6; color: #333333;">
                            <td>
                                <asp:HyperLink ID="HyperLink1" Style="padding: 0px 5px 0px 5px"
                                    runat="server" Target="_parent" NavigateUrl='<%# ShowLink((Guid)Eval("Obj.Id"), (BaseObject)Eval("Obj")) %>'>Open</asp:HyperLink>
                            </td>
                            <td>
                                <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Obj.Name") %>' />
                            </td>
                            <td>
                                <asp:Label ID="DatetimeLabel" runat="server" Text='<%# Eval("Obj.Datetime") %>' />
                            </td>
                            <td>
                                <asp:Label ID="TypeLabel" runat="server" Text='<%# ShowType((BaseObject)Eval("Obj"))  %>' />
                            </td>
                            <td>
                                <asp:LinkButton ID="lbtnDelete" Text="Delete" Style="padding: 0px 5px 0px 5px"
                                    runat="server" CommandName="TryDelete" CommandArgument='<%# (Guid)Eval("Obj.Id") %>'
                                    OnCommand="butDelete_OnCommand" />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table id="itemPlaceholderContainer" runat="server"
                                        border="1" style="background-color: #FFFFFF; border-collapse: collapse;
                                        border-color: #999999; border-style: none; border-width: 1px;
                                        font-family: Verdana, Arial, Helvetica, sans-serif">
                                        <tr runat="server" style="background-color: #FFFBD6;
                                            color: #333333;">
                                            <th runat="server">
                                            </th>
                                            <th runat="server" style="width: 200px">
                                                Name
                                            </th>
                                            <th runat="server" style="width: 150px">
                                                Datetime
                                            </th>
                                            <th runat="server" style="width: 150px">
                                                Type
                                            </th>
                                            <th runat="server">
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <td runat="server" style="text-align: center; background-color: #FFCC66;
                                    font-family: Verdana, Arial, Helvetica, sans-serif;
                                    color: #333333;">
                                    <asp:DataPager ID="DataPager1" runat="server">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
                                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                            <asp:NumericPagerField />
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True"
                                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                                        </Fields>
                                    </asp:DataPager>
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                </asp:ListView>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
